Skip to content

feat(calendar): add calendar management tools#279

Open
oskarcode wants to merge 4 commits intogemini-cli-extensions:mainfrom
oskarcode:feat/calendar-tools
Open

feat(calendar): add calendar management tools#279
oskarcode wants to merge 4 commits intogemini-cli-extensions:mainfrom
oskarcode:feat/calendar-tools

Conversation

@oskarcode
Copy link
Contributor

Summary

Adds three new Google Calendar tools for advanced calendar management.

New Tools

calendar.createCalendar

Creates a new calendar.

  • Parameters: summary, description (optional), timeZone (optional)

calendar.createRecurringEvent

Creates a recurring event in a calendar with RRULE support.

  • Parameters: calendarId (optional), summary, description (optional), start, end, attendees (optional), recurrence, reminders (optional)

calendar.setEventReminders

Sets custom reminders for an existing calendar event or resets to default reminders.

  • Parameters: eventId, calendarId (optional), useDefault (optional), overrides (optional)

Changes

  • Added createCalendar, createRecurringEvent, setEventReminders methods to CalendarService.ts
  • Added corresponding interfaces for input types
  • Registered all three new tools in index.ts

Testing

Tested locally with Google Calendar.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the calendar management capabilities by introducing new tools for creating calendars, managing recurring events with detailed recurrence rules, and customizing event reminders. It also streamlines the existing event creation and update processes by removing previously supported Google Meet and attachment features, focusing on core calendar functionalities.

Highlights

  • New Calendar Management Tools: Added three new Google Calendar management tools: createCalendar, createRecurringEvent, and setEventReminders.
  • Recurring Event Support: Introduced support for creating recurring events using RRULE specifications.
  • Custom Event Reminders: Enabled setting custom reminders for existing calendar events.
  • Refactored Event Functionality: Refactored existing event creation and update functionalities by removing Google Meet integration and attachment handling.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • workspace-server/src/index.ts
    • Registered new calendar.createCalendar, calendar.createRecurringEvent, and calendar.setEventReminders tools with their respective input schemas.
  • workspace-server/src/services/CalendarService.ts
    • Removed crypto import and EventAttachment interface.
    • Updated CreateEventInput and UpdateEventInput interfaces to remove sendUpdates, addGoogleMeet, and attachments properties.
    • Added CreateRecurringEventInput, CreateCalendarInput, and SetEventRemindersInput interfaces.
    • Removed the applyMeetAndAttachments private helper method.
    • Implemented createRecurringEvent, createCalendar, and setEventReminders methods.
    • Modified createEvent and updateEvent methods to remove Google Meet and attachment-related logic.
Activity
  • The author, oskarcode, has tested the new functionalities locally with Google Calendar.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces three new tools for Google Calendar management: createCalendar, createRecurringEvent, and setEventReminders. While the implementation of these new features is sound, the pull request also introduces significant breaking changes to the existing createEvent and updateEvent tools by removing support for Google Meet links and attachments. This constitutes a major feature regression. Furthermore, there's a regression in createEvent where it no longer sends notifications to attendees by default. I've added comments with high and critical severity to address these regressions, along with a medium-severity suggestion to refactor duplicated error-handling code for better maintainability.

Comment on lines 13 to 20
export interface CreateEventInput {
calendarId?: string;
summary: string;
description?: string;
start: { dateTime: string };
end: { dateTime: string };
attendees?: string[];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This change removes sendUpdates, addGoogleMeet, and attachments from the CreateEventInput interface. This is a significant breaking change for the calendar.createEvent tool, as it removes the ability to add Google Meet links, attach files, and control notifications. This functionality seems to have been removed entirely, which is a major feature regression. A similar breaking change has been made to UpdateEventInput.

Was this removal intentional? If so, it should be clearly documented as a breaking change in the pull request description. If it was not intentional, these fields and their corresponding logic should be restored.

Comment on lines +370 to +381
const event = {
summary,
description,
start,
end,
attendees: attendees?.map((email) => ({ email })),
};

const calendar = await this.getCalendar();
const insertParams: calendar_v3.Params$Resource$Events$Insert = {
const res = await calendar.events.insert({
calendarId: finalCalendarId,
requestBody: event,
sendUpdates: finalSendUpdates,
};
this.applyMeetAndAttachments(
event,
insertParams,
addGoogleMeet,
attachments,
);

const res = await calendar.events.insert(insertParams);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The logic for sending notifications to attendees has been removed. By omitting the sendNotifications parameter in the calendar.events.insert call, it will default to false according to the Google Calendar API documentation. This prevents attendees from receiving email invitations for new events, which is a significant regression in functionality. The previous behavior of sending notifications by default when attendees are present should be restored.

Suggested change
const event = {
summary,
description,
start,
end,
attendees: attendees?.map((email) => ({ email })),
};
const calendar = await this.getCalendar();
const insertParams: calendar_v3.Params$Resource$Events$Insert = {
const res = await calendar.events.insert({
calendarId: finalCalendarId,
requestBody: event,
sendUpdates: finalSendUpdates,
};
this.applyMeetAndAttachments(
event,
insertParams,
addGoogleMeet,
attachments,
);
const res = await calendar.events.insert(insertParams);
});
const event = {
summary,
description,
start,
end,
attendees: attendees?.map((email) => ({ email })),
};
const calendar = await this.getCalendar();
const res = await calendar.events.insert({
calendarId: finalCalendarId,
requestBody: event,
sendNotifications: attendees?.length ? 'all' : 'none',
});

Comment on lines +192 to +204
} catch (error) {
const errorMessage =
error instanceof Error ? error.message : String(error);
logToFile(`Error during calendar.createRecurringEvent: ${errorMessage}`);
return {
content: [
{
type: 'text' as const,
text: JSON.stringify({ error: errorMessage }),
},
],
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The error handling logic in this catch block is duplicated in the createCalendar and setEventReminders methods. To follow the DRY (Don't Repeat Yourself) principle and improve maintainability, this logic should be extracted into a shared private helper function.

For example, you could add a new private method like this:

private createApiErrorResponse(error: unknown, toolName: string) {
  const errorMessage =
    error instanceof Error ? error.message : String(error);
  logToFile(`Error during ${toolName}: ${errorMessage}`);
  return {
    content: [
      {
        type: 'text' as const,
        text: JSON.stringify({ error: errorMessage }),
      },
    ],
  };
}

And then call it from the catch blocks, e.g., return this.createApiErrorResponse(error, 'calendar.createRecurringEvent');.

…pdateEvent

- Add sendUpdates parameter to CreateRecurringEventInput interface
- Add sendUpdates parameter to UpdateEventInput interface
- Implement sendUpdates logic in createRecurringEvent method
- Implement sendUpdates logic in updateEvent method
- Default to 'all' when attendees present, 'none' when no attendees
- Ensures attendees receive notifications for recurring events and updates

Fixes critical issue where attendees were not notified of recurring events or event changes.
- Add getErrorMessage() helper method for consistent error message extraction
- Replace 12 duplicate error handling patterns with helper method call
- Addresses code review feedback about duplicate logic in PR gemini-cli-extensions#279
- Maintains existing error handling behavior with cleaner implementation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant